package com.cangshukj.web.controller.junong;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.cangshukj.common.annotation.Log;
import com.cangshukj.common.core.controller.BaseController;
import com.cangshukj.common.core.domain.AjaxResult;
import com.cangshukj.common.enums.BusinessType;
import com.cangshukj.junong.domain.LandPics;
import com.cangshukj.junong.service.ILandPicsService;
import com.cangshukj.common.utils.poi.ExcelUtil;
import com.cangshukj.common.core.page.TableDataInfo;

/**
 * 图片附件Controller
 * 
 * @author wangjie
 * @date 2025-04-01
 */
@RestController
@RequestMapping("/land/pics")
public class LandPicsController extends BaseController
{
    @Autowired
    private ILandPicsService landPicsService;

    /**
     * 查询图片附件列表
     */
    @PreAuthorize("@ss.hasPermi('land:pics:list')")
    @GetMapping("/list")
    public TableDataInfo list(LandPics landPics)
    {
        startPage();
        List<LandPics> list = landPicsService.selectLandPicsList(landPics);
        clearPage();
        return getDataTable(list);
    }

    /**
     * 获取图片附件详细信息
     */
    @PreAuthorize("@ss.hasPermi('land:pics:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(landPicsService.selectLandPicsById(id));
    }

    /**
     * 新增图片附件
     */
    @PreAuthorize("@ss.hasPermi('land:pics:add')")
    @Log(title = "图片附件", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody LandPics landPics)
    {
        return toAjax(landPicsService.insertLandPics(landPics));
    }

    /**
     * 修改图片附件
     */
    @PreAuthorize("@ss.hasPermi('land:pics:edit')")
    @Log(title = "图片附件", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody LandPics landPics)
    {
        return toAjax(landPicsService.updateLandPics(landPics));
    }

    /**
     * 删除图片附件
     */
    @PreAuthorize("@ss.hasPermi('land:pics:remove')")
    @Log(title = "图片附件", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(landPicsService.deleteLandPicsByIds(ids));
    }
}
